package com.sgb.kjwl.view.widget;

import android.content.Context;
import androidx.recyclerview.widget.GridLayoutManager;
import com.sgb.kjwl.R;
import com.sgb.kjwl.model.entity.EnquiryTypeEntity;
import com.sgb.kjwl.view.ui.adapter.carrierDemand.DemandHallTypeAdapter;
import com.swgk.core.dialog.BasePopWindow;
import com.swgk.core.dialog.PopViewHolder;
import com.swgk.core.recyclerview.adapter.AdapterOnItemClick;
import java.util.List;

public class Enquirytypepopwindow extends BasePopWindow {

    private DemandHallTypeAdapter demandhalltypeadapter;

    public Enquirytypepopwindow(Context context) {
        super(context);
    }

    @Override
    protected int popLayout() {
        return R.layout.popwindow_goods_type3;
    }

    @Override
    protected void initView(PopViewHolder holder) {
        MaxHeightRecyclerView recyclerView = holder.getPop().findViewById(R.id.goods_type_list);
        demandhalltypeadapter = new DemandHallTypeAdapter(mContext,null);
        demandhalltypeadapter.setItemSelect(true);
        demandhalltypeadapter.setDefItem(-1);
        recyclerView.setLayoutManager(new GridLayoutManager(mContext,4));
        recyclerView.setAdapter(demandhalltypeadapter);

        demandhalltypeadapter.setOnItemClick(new AdapterOnItemClick<EnquiryTypeEntity>() {
            @Override
            public void onItemClick(EnquiryTypeEntity enquirytypeentity, int position) {
                onResultClick.result(enquirytypeentity,null,null);
                dissMiss();
            }
        });

        /*holder.getPop().findViewById(R.id.bg_pop_gray_layout).setOnClickListener(view -> dissMiss());*/

    }
    public void setData(List<EnquiryTypeEntity> enquirylist) {
        demandhalltypeadapter.setDatas(enquirylist);
    }
}
